package entityBeans;

import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import java.util.HashSet;
import java.util.Set;

@Entity
public class Contact {
	
	  private static final String mappedBy = null;
	private String firstName;
	  private String lastName;
	  private String email;
	  private long id; 
	  
	  @Embedded
	  private Address add;
	  
	  @Embedded
	  private Set<ContactGroup> books = new HashSet<ContactGroup>();
	  
	  @Embedded
	  private Set<PhoneNumber> profiles = new HashSet<PhoneNumber>();
	  
	  
	  
	  public Contact(){
			
		}
		
		public Contact(String firstname2, String lastname2, String emailC) {
			this.firstName = firstname2;
			this.lastName = lastname2;
			this.email = emailC;
		}
		
	@Id@GeneratedValue(strategy=GenerationType.AUTO)
	  public long getId() {return id;}

	  public void setId(long l) {id = l;}
	  public String getEmail() {return email;}

	  public String getFirstName() {return firstName; }

	  public String getLastName() {return lastName; }

	  public void setEmail(String string) {email = string; }

	  public void setFirstName(String string) {firstName = string; }

	  public void setLastName(String string) {lastName = string; }
	  
	  public Address getAdd() {
			return add;
	  }
	  
	  public void setAdd(Address add) {
			this.add = add;
	  }
	  
	  public Set<ContactGroup> getBooks() {
			return books;
		}
	  
	  public void setBooks(Set<ContactGroup> books) {
			this.books = books;
	  }
		
	  
	  @OneToMany(mappedBy="contact")
	  public Set<PhoneNumber> getProfiles() {
			return profiles;
	  }
		
	  public void setProfiles(Set<PhoneNumber> profiles) {
			this.profiles = profiles;
	  }
		
	  @Override
	  public String toString() {
			return firstName + " " + lastName + "\n" + email; 
	  }


}
